<template>
	<view>
	    <uni-datetime-picker type="date" :value="date" @change="handleDateChange"></uni-datetime-picker>
		<ItemList :listData="seleteData"></ItemList>
	</view>
</template>

<script>
	import ItemList from "../../component/list/ItemList.vue"
	export default{
		components:{
			// Search,
			ItemList
		},
		data(){
			return{
				seleteData:[],
				date:""
			}
		},
		computed:{
			
			
		},
		methods:{
			handleDateChange(event){
				this.date=event
				console.log(this.date)
				this.seleteData=getApp().globalData.listData.filter((i)=>{
					return i.date===this.date
				})
			}
		},
		async onShow(){
			// if(getApp().globalData.loginUpdate){
			// 	let res=await uniCloud.callFunction({
			// 		name:"getDatas",
			// 		data:{openid:getApp().globalData.userData.openid}
			// 	})
			// 	console.log(res)
			// 	getApp().globalData.loginUpdate=false
			// 	getApp().globalData.listData=res.result
			// }
			this.seleteData=getApp().globalData.listData
			console.log(getApp().globalData.listData)
			console.log("List onShow")
		},
		onHide(){
			this.date=""
		}
	}
</script>

<style>
	picker{
		border: 1px solid #606266;
		margin: 40rpx;
		height: 80rpx;
		border-radius: 10rpx;
		line-height: 80rpx;
		text-align: center;
	}
</style>
